//
//  BaseTableViewController.swift
//  SinaWeibo
//
//  Created by yang on 15/11/8.
//  Copyright © 2015年 yang. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {
    
    var userLogin = UserAccountViewModel().userLogin
    var visitorLoginView : VisitorLoginView?
    //loaView 在viewDidLoad之前调用
    override func loadView() {
        userLogin ? super.loadView() : loadVisitorLoginView()
    }
    //加载自定义 View
    private func loadVisitorLoginView() {
        visitorLoginView = VisitorLoginView()
        visitorLoginView?.visitorLoginViewDelegate = self
        view = visitorLoginView
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "visitorWillRegister")
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: .Plain, target: self, action: "visitorWillLogin")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    //登陆
    func visitorWillLogin(){
        let auto = AouthViewController()
        let nav = UINavigationController(rootViewController: auto)
        presentViewController(nav, animated: true, completion: nil)
    }
    //注册
    func visitorWillRegister(){
        print("注册")
    }
    
}
